﻿using System;
using System.Collections.Generic;
using System.Linq;

using Keyki.NefClass.Kernel.Data;
using Keyki.NefClass.Kernel.Fuzzy.Rulles;

namespace Keyki.NefClass.Kernel.Fuzzy.ChooceRule
{
	/// <summary>
	/// Makes Rule base with rules with best performance
	/// </summary>
	public class BestRule : AbstractRule
	{
		public override void Procedure(List<Antecedent> antecedents, DataSet dataSet, ref List<FuzzyRule> rulles, int countRules)
		{
			List<FuzzyRule> fuzzyRules = null;

			CreateAllRules(antecedents, dataSet, out fuzzyRules);

			rulles.AddRange(fuzzyRules.OrderByDescending(x => x.Performance).GetRange(0,countRules));
		}//Procedure

		
	}//BestRule
}